package com.itboye.jinpuyiyuan.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.itboye.jinpuyiyuan.R;
import com.itboye.jinpuyiyuan.bean.GoodBean;
import com.itboye.jinpuyiyuan.bean.NoticeBean;
import com.squareup.okhttp.internal.Util;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2017/12/8 0008.
 */

public class NoticeListAdapter extends BaseAdapter {
    private List<NoticeBean> list;
    private Context context;
    private LayoutInflater inflater;
    public NoticeListAdapter(Context context,List<NoticeBean> list){

        this.list=list;
        this.context=context;
        inflater=LayoutInflater.from(context);
    }
    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        GoodViewHolder goodViewHolder;
        if (convertView==null){
            goodViewHolder=new GoodViewHolder();
            convertView=inflater.inflate(R.layout.item_goodlist,parent,false);
            goodViewHolder.doctorContent=convertView.findViewById(R.id.doctorContent);
            goodViewHolder.doctorName=convertView.findViewById(R.id.doctorName);
            goodViewHolder.date=convertView.findViewById(R.id.date);
            goodViewHolder.doctorImg=convertView.findViewById(R.id.doctorImg);
            convertView.setTag(goodViewHolder);
        }else {
            goodViewHolder= (GoodViewHolder) convertView.getTag();
        }
            goodViewHolder.doctorName.setText(list.get(position).getMsg_type_name());
            goodViewHolder.doctorContent.setText(list.get(position).getContent());
//            goodViewHolder.date.setText(list.get(position).getDate());
            goodViewHolder.date.setText("刚刚");

        return convertView;
    }

    class GoodViewHolder {

        TextView doctorName,doctorContent,date;
        ImageView doctorImg;

    }
}
